To truly master Git, one must look beneath the user-friendly surface of Porcelain commands to understand the Plumbing—the low-level engine that manages Git’s internal object database. This database is a content-addressable filesystem where every piece of data is stored as an immutable object.
1. Porcelain vs. Plumbing
Porcelain refers to high-level commands (like git status) designed for human interaction. Plumbing refers to low-level commands that manipulate the Git object database directly, giving us access to Git’s true internal representation.
2. The Object Database
Git operates as a key-value store within the .git/objects directory, housing internal objects: blobs, trees, commits, and tags. Branches, while often discussed with objects, serve as references to these commits.
3. SHA-1 Addressing
Every object is named by a unique 40-character hexadecimal SHA-1 checksum. Git optimizes storage by using the first two characters as a subdirectory name (e.g., af/) and the remaining 38 as the filename.